import formatTime from '../../utils/formatTime.js'
Component({
  properties: {
    blog: {
      type: Object
    }
  },
  observers: {
    ['blog.createTime'](val) {
			// 进入详情时获取到的时间是 undefined
			if (val != undefined) {
				this.setData({
					createTimeFmt: formatTime(new Date(val))
				})
			}
    }
  },

  data: {
    createTimeFmt: ''
  },

  methods: {
		// 图片预览
		onPreviewImage(e) {
			wx.previewImage({
				urls: this.properties.blog.img,
				current: e.currentTarget.dataset.url
			})
		}
  }
})